package com.lin.manager.oss.storage.engine.aliyun;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import com.lin.manager.oss.storage.StorageClientFactory;
import com.lin.manager.oss.model.StorageClient;
import lombok.extern.slf4j.Slf4j;

/**
 * @author linjiang
 * @date 2024/7/26
 * @fn
 */
@Slf4j
public class AliyunStorageClientFactory implements StorageClientFactory<OSS> {

    StorageClient client;

    public AliyunStorageClientFactory(StorageClient client) {
        this.client = client;
    }

    @Override
    public OSS getClient() {
        OSS ossClient = new OSSClientBuilder().build(client.getOssEndpoint(), client.getOssAccessKeyId(), client.getOssAccessKeySecret());
        return ossClient;
    }
}
